package com.start.workflow.model;

import cn.hutool.core.date.LocalDateTimeUtil;
import com.start.workflow.entity.StartActModelConfig;
import com.start.workflow.entity.StartActReModelExt;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.activiti.engine.repository.Model;

import java.util.Map;

@Data
public class StartProcessModelConfigDetail {
    @Schema(name = "流程模型基础配置信息")
    private StartProcessModel processModel;

    @Schema(name = "流程模型配置")
    private Map<String, Map<String, Map<String, StartActModelConfig>>> configMap;

    public StartProcessModelConfigDetail() {

    }

    public StartProcessModelConfigDetail(Model model, StartActReModelExt startActReModelExt) {
        processModel = new StartProcessModel();
        processModel.setId(model.getId());
        processModel.setActModelName(model.getName());
        processModel.setActModelCategory(model.getCategory());
        processModel.setActModelVersion(model.getVersion());
        processModel.setActModelKey(model.getKey());
        processModel.setTenantId(model.getTenantId());
        processModel.setCreateTime(LocalDateTimeUtil.of(model.getCreateTime()));
        processModel.setLastUpdateTime(LocalDateTimeUtil.of(model.getLastUpdateTime()));
        processModel.setModelIcon(startActReModelExt.getModelIcon());
        processModel.setSort(startActReModelExt.getSort());
    }
}
